<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>人员报表</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
</head>
<body>
<div class="demoTable layui-form" style="padding:10px 0 0 15px">
	<table>
		<tr>
			<td><input class="layui-input" name="time" id="time" placeholder="请选择日期" autocomplete="off"></td>
			<td>
				<div class="layui-input-block" style="width: 150px; margin-left: 20px;">
		  			<select id="uid" name="uid" lay-verify="uid" autocomplete="off" style="width:170px; height:40px; float: left">
						<option value="">请选择员工</option>
						<c:forEach items="${allUser }" var="user">
							<option value="${user.uid }" >${user.userName }</option>
						</c:forEach>
					</select>
	       		</div>
       		</td>
			<td><button class="layui-btn layui-btn-blue" style="margin: 0 0 0 10px; margin-left: 20px" data-type="reload"><i class="layui-icon layui-icon-search">  搜索</i></button></td>
		</tr>
	</table>
</div>

<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
<script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>

<script type="text/html" id="toolbarDemo">
	<div class="layui-btn-container">
		<button class="layui-btn layui-btn-blue" id="update" lay-event="update"><i class="layui-icon layui-icon-add-1">更新</i></button>
	</div>
</script>

<br><br>

<!-- 动态加载进度条 -->
<!-- <div class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="demo">
  <div class="layui-progress-bar layui-bg-red" lay-percent="0%"></div>
</div> -->

<!-- <div class="site-demo-button layui-btn-container" >
  <button class="layui-btn site-demo-active layui-btn-blue" data-type="loading"><i class="layui-icon layui-icon-add-1">更新</i></button>
</div> -->

<table class="layui-hide" id="test" lay-filter="test"></table>
 
<script>
layui.use(['table','layer','upload','form','carousel'], function(){
	var carousel = layui.carousel;
	var table = layui.table;
	var layer = layui.layer;
    var form = layui.form;
	var laydate = layui.laydate;
	
	//执行一个laydate实例
	laydate.render({
		elem: '#time' //指定元素
		,type: 'month' //年月选择
	});
	var $ = layui.jquery, active = {
			reload:function () {
				var time = $("#time").val();
				var uid = $("#uid").val();
				table.reload('contenttable',{
					method:'get',
					where:{time: time, uid: uid}
				});
			}
		}
	$('.layui-btn').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
	table.render({
	    elem: '#test'
	    ,url:'${pageContext.request.contextPath }/reportMana2/listUserReportByTimeAndUid.do'
	    ,toolbar: '#toolbarDemo'
	    ,title: '人员报表'
	    ,id :'contenttable'
	    ,height: '650px'
	    ,cols: [
	    	[
	    		{field:'', title:'序号', sort: true, type:'numbers', width: 60},
	    		{
	    			field:'dateTime',
	    			title:'日期',
	    			align:'center', 
	    			templet: function(d){
	    		    	if(null == d.dateTime){
	    		    		return '';
	    		    	}else{
	    		    		return d.dateTime;
	    		    	}
	    		    }	
	    		},
	    		{
	    			field:'teamName',
	    			title:'班次',
	    			align:'center', 
	    			templet: function(d){
	    				if(null == d.teamName){
	    		    		return '';
	    		    	}else{
	    		    		return d.teamName;
	    		    	}
	    		    }	
	    		},
	    		{
	    			field:'membrane',
	    			title:'膜芯制作',
	    			align:'center', 
	    			templet: function(d){
	    				if(null == d.membrane){
	    		    		return '';
	    		    	}else{
	    		    		return d.membrane;
	    		    	}
	    		    }	
	    		},
	    		{
	    			field:'asassemble',
	    			title:'组装',
	    			align:'center', 
	    			templet: function(d){
	    				if(null == d.assemble){
	    		    		return '';
	    		    	}else{
	    		    		return d.assemble;
	    		    	}
	    		    }	
	    		},
	    		{
	    			field:'centrifuge',
	    			title:'离心',
	    			align:'center', 
	    			templet: function(d){
	    				if(null == d.centrifuge){
	    		    		return '';
	    		    	}else{
	    		    		return d.centrifuge;
	    		    	}
	    		    }	
	    		},
	    		{
	    			field:'solidify',
	    			title:'拆端盖',
	    			align:'center', 
	    			templet: function(d){
	    				if(null == d.solidify){
	    		    		return '';
	    		    	}else{
	    		    		return d.solidify;
	    		    	}
	    		    }	
	    		},
	    		{
	    			field:'incise',
	    			title:'切割',
	    			align:'center', 
	    			templet: function(d){
	    				if(null == d.incise){
	    		    		return '';
	    		    	}else{
	    		    		return d.incise;
	    		    	}
	    		    }	
	    		}
	    	],
	    ]
	    ,page: false
	});
	
	//头工具栏事件
	table.on('toolbar(test)', function(obj){
		var time = $("#time").val();
		switch(obj.event){
	    	case 'update':
	        	layer.confirm('确定更新吗？', function(index){
	        		$("#update").attr("disabled",true);
	        		$.ajax({
				    	type:'post',
				    	url:'${pageContext.request.contextPath }/reportMana2/renewalUserReport.do',
				    	success:function(data){
				    		if(data>0){
				    			toastr.success("更新成功！");
				    			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
									//关闭模态框
									// 父页面刷新
									window.location.reload();  
								},2000); 
				    		}else{
				    			toastr.error("更新失败！");
				    		}
				    	}
				    });
	        		layer.close(index); 
	        	});
	      	break;
	    };
	});
	
});

toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上

//更新的进度条
/* layui.use('element', function(){
	var $ = layui.jquery
	,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
	
	//触发事件
	
	var active = {
		loading: function(othis){
			var i = 0;
			var DISABLED = 'layui-btn-disabled';
			if(othis.hasClass(DISABLED)) return;
			//模拟loading
			var n = 0, timer = setInterval(function(){
				n = n + 0.8;  
			    if(n>95){
			    	n = 95 + i;
				    clearInterval(timer);
				    othis.removeClass(DISABLED);
			  	}
			  	element.progress('demo', n+'%');
			}, 300+Math.random()*1000);
			othis.addClass(DISABLED);
			$.ajax({
		    	type:'post',
		    	url:'${pageContext.request.contextPath }/reportMana2/job.do',
		    	success:function(data){
		    		if(data>0){
						i = 50;
		    			toastr.success("更新成功！");
		    			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
		    				//关闭模态框
							// 父页面刷新
							window.location.reload();  
						},2000); 
		    		}else{
		    			i = 50;
		    			toastr.error("更新失败！");
		    		}
		    	}
		    }); 
		}
	};
	$('.site-demo-active').on('click', function(){
		var othis = $(this), type = $(this).data('type');
		active[type] ? active[type].call(this, othis) : '';
	});
}); */

</script>

</body>
</html>